-
Notifications
You must be signed in to change notification settings - Fork 71
[RUM-9899]: TracingInterceptor migration #2708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...-sdk-android-trace-internal/src/main/java/com/datadog/trace/api/interceptor/MutableSpan.java
Show resolved
Hide resolved
features/dd-sdk-android-trace-internal/src/main/java/com/datadog/trace/core/PendingTrace.java
Outdated
Show resolved
Hide resolved
...tions/dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/DatadogInterceptor.kt
Outdated
Show resolved
Hide resolved
...k-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/internal/otel/TraceContextExt.kt
Outdated
Show resolved
Hide resolved
...dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/TracingInterceptor.kt
Show resolved
Hide resolved
...oid-okhttp/src/test/kotlin/com/datadog/android/okhttp/DatadogInterceptorWithoutTracesTest.kt
Outdated
Show resolved
Hide resolved
...dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/TracingInterceptor.kt
Outdated
Show resolved
Hide resolved
...dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/TracingInterceptor.kt
Outdated
Show resolved
Hide resolved
...dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/TracingInterceptor.kt
Outdated
Show resolved
Hide resolved
...tions/dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/DatadogInterceptor.kt
Outdated
Show resolved
Hide resolved
features/dd-sdk-android-trace-internal/src/main/java/com/datadog/trace/core/CoreTracer.java
Show resolved
Hide resolved
...dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/TracingInterceptor.kt
Outdated
Show resolved
Hide resolved
...dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/TracingInterceptor.kt
Show resolved
Hide resolved
...dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/TracingInterceptor.kt
Outdated
Show resolved
Hide resolved
...k-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/internal/otel/TraceContextExt.kt
Outdated
Show resolved
Hide resolved
...-sdk-android-trace-internal/src/main/java/com/datadog/trace/api/interceptor/MutableSpan.java
Show resolved
Hide resolved
features/dd-sdk-android-trace-internal/src/main/java/com/datadog/trace/core/DDSpan.java
Show resolved
Hide resolved
features/dd-sdk-android-trace-internal/src/main/java/com/datadog/trace/core/PendingTrace.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general. We're missing the part where we are able to inject our own tracer into the DatadogInterceptor#builder
, see the Slack thread but I guess this can still be added into this PR.
...ions/dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/OtelMigration.kt
Outdated
Show resolved
Hide resolved
caa0454
to
253eace
Compare
dd-sdk-android-internal/src/main/java/com/datadog/android/internal/utils/CastExt.kt
Outdated
Show resolved
Hide resolved
186412e
to
4897596
Compare
… resolution during one of last commit squashing procedure
…xtension implementations
…eTracer and related classes for customers. The only publicity available ways for tracing feature usage: - okhttp instrumentation - manual instrumentation with Otel so it's okay that TracerContext is the only way to set the parent span (otherwise AgentSpan will be exposed)
lgtm but better wait also for @mariusc83 approval |
...trace-internal/src/main/java/com/datadog/trace/bootstrap/instrumentation/api/TagContext.java
Show resolved
Hide resolved
...s/dd-sdk-android-trace-internal/src/main/java/com/datadog/trace/api/config/TracerConfig.java
Show resolved
Hide resolved
sample/kotlin/src/main/kotlin/com/datadog/android/sample/SampleApplication.kt
Show resolved
Hide resolved
… to meta, reverting _dd object back to log
c33379f
to
c32340a
Compare
@@ -35,17 +35,17 @@ data class com.datadog.android.log.LogsConfiguration | |||
fun setEventMapper(com.datadog.android.event.EventMapper<com.datadog.android.log.model.LogEvent>): Builder | |||
fun build(): LogsConfiguration | |||
data class com.datadog.android.log.model.LogEvent | |||
constructor(Device, Os, Status, kotlin.String, kotlin.String, kotlin.String, Logger, Usr? = null, Account? = null, Network? = null, Error? = null, kotlin.String? = null, kotlin.String, kotlin.collections.MutableMap<kotlin.String, kotlin.Any?> = mutableMapOf()) | |||
constructor(LogEventDevice, Os, Status, kotlin.String, kotlin.String, kotlin.String, Logger, Dd, Usr? = null, Account? = null, Network? = null, Error? = null, kotlin.String? = null, kotlin.String, kotlin.collections.MutableMap<kotlin.String, kotlin.Any?> = mutableMapOf()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems these changes should already be in v3, is develop
only merged in the tracing branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change appears because we have to revert os
and device
back to meta in this commit. The change was made in this branch, but not in separate ticket to speed up next dogfooding interation
...id-trace-api/src/main/kotlin/com/datadog/android/trace/api/propagation/DatadogPropagation.kt
Outdated
Show resolved
Hide resolved
...s/dd-sdk-android-trace-api/src/main/kotlin/com/datadog/android/trace/api/span/DatadogSpan.kt
Outdated
Show resolved
Hide resolved
# Required because we need access to GlobalTracer isRegistered property to reset it through reflection | ||
-keepnames class io.opentracing.util.GlobalTracer { | ||
private boolean isRegistered; | ||
# Required because we need access to GlobalDatadogTracer getOrNull method to reset it through reflection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is already declared in the trace
module, so I guess re-declaration is not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not tested yet, gonna remove in separate ticket RUM-11362 (after we make a decision regarding publicitly available DatadogTracer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean here is that it is already declared in the Proguard rules file of the Tracing module and so will be added from there.
...dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/TracingInterceptor.kt
Outdated
Show resolved
Hide resolved
...dd-sdk-android-okhttp/src/main/kotlin/com/datadog/android/okhttp/trace/TracingInterceptor.kt
Show resolved
Hide resolved
...khttp/src/test/kotlin/com/datadog/android/okhttp/internal/utils/forge/TraceContextFactory.kt
Show resolved
Hide resolved
...bility/single-fit/okhttp/src/test/kotlin/com/datadog/android/okhttp/HeadBasedSamplingTest.kt
Outdated
Show resolved
Hide resolved
fun activateSpan(span: DatadogSpan, asyncPropagating: Boolean): DatadogScope? internal
/** | ||
* Represents the duration of a span in nanoseconds. | ||
*/ | ||
val durationNano: Long | ||
|
||
/** | ||
* Represents the start time of the span in nanoseconds. | ||
*/ | ||
val startTimeNanos: Long |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: it is better to have consistent naming, so it should be durationNanos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gonna address this in next PR if possible
fun get(): com.datadog.android.trace.api.tracer.DatadogTracer | ||
fun getOrNull(): com.datadog.android.trace.api.tracer.DatadogTracer? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need both? maybe we should leave only one of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gonna address this in next PR if possible
1cdef63
to
1e8df9f
Compare
What does this PR do?
This PR contains major change for tracer migration.
I tried to reduce amount of changes with some tricks with kotlin's
typealias
but it still huge. Maybe some of you will find it easier to review by commits.Main changes:
AndroidTracer
toCoreTracer
inTracingInterceptor
and it descendants.Please pay attention to:
Despite the fact that the APIs of CoreTracer and AndroidTracer are similar, some methods were either not supported or supported at a different level of abstraction. In such cases, I implemented the closest and simplest solution and added comments so you could spot them.
Known issues
GlobalTracer
, butTracingInterceptor
relies on some globally storedCoreTracer
instance. Going to discuss this with the team and provide solution with separate PR.Review checklist (to be filled by reviewers)